import request from '@/utils/request'

// 查询等级
export const getSystemMenuList = (params) => {
    return request({
        url: '/online/authorization/admin/character/level',
        method: 'get',
        params
    })
}

// 新增等级
export function addLevel(data) {
    return request({
        url: '/online/authorization/admin/character/level',
        method: 'POST',
        data
    })
}

// 修改等级
export function editLevel(id,data) {
    return request({
        url: '/online/authorization/admin/character/level/'+id,
        method: 'POST',
        data
    })
}

// 删除等级
export function deleteLevel(id) {
    return request({
      url: `/online/authorization/admin/character/level/${id}`,
      method: 'DELETE'
    })
  }

  // 获取编辑框回显
export function getLevelInfo(id) {
    return request({
      url: `/online/authorization/admin/character/level/${id}`,
      method: 'GET'
    })
  }

// 查询权限
export const getFunctionList = (params) => {
    return request({
        url: '/online/authorization/admin/character/level/function',
        method: 'get',
        params
    })
}

//修改授权
export function editFunction(data) {
    return request({
        url: '/online/authorization/admin/character/level/function',
        method: 'POST',
        data
    })
}

//获取所有的characterCode
export function getCharacter() {
    return request({
      url: `/online/authorization/admin/character/all`, method: 'get'
    })
  }

  //获取所有的菜单和权限
export function getAllPermission(characterCode) {
    return request({
      url: `/online/authorization/admin/menu/platform/character-code/${characterCode}/permissions`, method: 'get'
    })
  }